﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Wwtfly.BBS.BackModels.Models.Plays;
using Wwtfly.BBS.BackDAL.Plays;
using Wwtfly.LoggerUtility;
using Wwtfly.BBS.Framework.Execption;
using Wwtfly.BBS.Framework.Common;
using System.Data;

namespace Wwtfly.BBS.BackBLL.Plays
{
   public class PlaysBLL
    {
        #region 属性
        //错误编码 (默认为不知原因的异常,使用者需要自己修改为相应的正确编码)
        private const string GET_INFO_ERROR_CODE = "9999";
        private const string GET_LIST_ERROR_CODE = "9999";
        private const string ADD_ERROR_CODE = "9999";
        private const string UPDATE_ERROR_CODE = "9999";
        private const string DELETE_ERROR_CODE = "9999";
        #endregion

         /// <summary>
        /// 获取22选5综合分布图
        /// </summary>
        /// <returns></returns>
        public static DataTable Select_22X5_HMFBListWinber()
        {
            try
            {
                return PlaysDAL.Select_22X5_HMFBListWinber();
            }
            catch (Exception ex)
            {
                LoggerManage.Error(new LogMessageParams()
                {
                    ModuleID = "PlaysDAL",
                    FuncCode = "static DataTable Select_22X5_HMFBListWinber()",
                    Level = AppErrorLevel.EROR,
                    ErrCode = "0x0",
                    Excep = ex,
                    logMessage = "获取22选5综合分布图.出错",
                    ProgramName = "Wwtilfy.BBS"
                });
                 return null;
            }
        }
         /// <summary>
        /// 获取排列五综合分布图
        /// </summary>
        /// <returns></returns>
        public static DataTable Select_PL5_HMFBListWinber()
        {
            try
            {
                return PlaysDAL.Select_PL5_HMFBListWinber();
            }
            catch (Exception ex)
            {
                LoggerManage.Error(new LogMessageParams()
                {
                    ModuleID = "PlaysDAL",
                    FuncCode = "DataTable Select_PL5_HMFBListWinber()",
                    Level = AppErrorLevel.EROR,
                    ErrCode = "0x0",
                    Excep = ex,
                    logMessage = "获取排列五综合分布图.出错",
                    ProgramName = "Wwtilfy.BBS"
                });
                 return null;
            }
        }
             /// <summary>
        /// 获取排列三综合分布图
        /// </summary>
        /// <returns></returns>
        public static DataTable Select_PL3_HMFBListWinber()
        {
            try
            {
                return PlaysDAL.Select_PL3_HMFBListWinber();
            }
            catch (Exception ex)
            {
                 LoggerManage.Error(new LogMessageParams()
                {
                    ModuleID = "PlaysDAL",
                    FuncCode = "DataTable Select_PL3_HMFBListWinber()",
                    Level = AppErrorLevel.EROR,
                    ErrCode = "0x0",
                    Excep = ex,
                    logMessage = "获取排列三综合分布图.出错",
                    ProgramName = "Wwtilfy.BBS"
                });
                 return null;
            }
        }
           /// <summary>
        /// 获取七乐彩综合分布图
        /// </summary>
        /// <returns></returns>
        public static DataTable Select_7LC_HMFBListWinber()
        {
            try
            {
                return PlaysDAL.Select_7LC_HMFBListWinber();
            }
            catch (Exception ex)
            {
                 LoggerManage.Error(new LogMessageParams()
                {
                    ModuleID = "PlaysDAL",
                    FuncCode = "DataTable Select_7LC_HMFBListWinber()",
                    Level = AppErrorLevel.EROR,
                    ErrCode = "0x0",
                    Excep = ex,
                    logMessage = "获取七乐彩综合分布图.出错",
                    ProgramName = "Wwtilfy.BBS"
                });
                 return null;
            }
        }
        /// <summary>
        /// 获取7星综合分布图
        /// </summary>
        /// <returns></returns>
        public static DataTable Select_7X_HMFBListWinber()
        {
            try
            {
                return PlaysDAL.Select_7X_HMFBListWinber();
            }
            catch (Exception ex)
            {
                 LoggerManage.Error(new LogMessageParams()
                {
                    ModuleID = "PlaysDAL",
                    FuncCode = " DataTable Select_7X_HMFBListWinber()",
                    Level = AppErrorLevel.EROR,
                    ErrCode = "0x0",
                    Excep = ex,
                    logMessage = "获取7星综合分布图.出错",
                    ProgramName = "Wwtilfy.BBS"
                });
                 return null;
            }
        }
        /// <summary>
        /// 获取大乐透综合分布图
        /// </summary>
        /// <returns></returns>
        public static DataTable SelectCJDLT_HMFBListWinber()
        {
            try
            {
                return PlaysDAL.SelectCJDLT_HMFBListWinber();
            }
            catch (Exception ex)
            { 
                 LoggerManage.Error(new LogMessageParams()
                {
                    ModuleID = "PlaysDAL",
                    FuncCode = " DataTable SelectCJDLT_HMFBListWinber()",
                    Level = AppErrorLevel.EROR,
                    ErrCode = "0x0",
                    Excep = ex,
                    logMessage = "获取大乐透综合分布图.出错",
                    ProgramName = "Wwtilfy.BBS"
                });
                 return null;
            }
        }
        /// <summary>
        /// 获取3D历史数据分析图
        /// </summary>
        /// <returns></returns>
        public static DataTable Select3DZHFBListWinber()
        {
            try
            {
                return PlaysDAL.Select3DZHFBListWinber();
            }
            catch (Exception ex)
            {
                
                 LoggerManage.Error(new LogMessageParams()
                {
                    ModuleID = "PlaysDAL",
                    FuncCode = "DataTable Select3DZHFBListWinber()",
                    Level = AppErrorLevel.EROR,
                    ErrCode = "0x0",
                    Excep = ex,
                    logMessage = "获取3D历史数据分析图.出错",
                    ProgramName = "Wwtilfy.BBS"
                });
                 return null;
            }

        }
        /// <summary>
        /// 获取双色球综合分布图
        /// </summary>
        /// <returns></returns>
        public static DataTable SelectSSQZHFBListWinber()
        {
            try
            {
                return PlaysDAL.SelectSSQZHFBListWinber();
            }
            catch (Exception ex)
            { 
                LoggerManage.Error(new LogMessageParams()
                {
                    ModuleID = "PlaysDAL",
                    FuncCode = "DataTable SelectSSQZHFBListWinber()",
                    Level = AppErrorLevel.EROR,
                    ErrCode = "0x0",
                    Excep = ex,
                    logMessage = "获取双色球综合分布图.出错",
                    ProgramName = "Wwtilfy.BBS"
                });
                 return null;
            }
        }
         /// <summary>
        /// 获取双色球历史数据分析图
        /// </summary>
        /// <returns></returns>
        public static DataTable SelectSSQdxListWinber()
        {
            try
            {
                return PlaysDAL.SelectSSQdxListWinber();
            }
            catch (Exception ex)
            {
                 LoggerManage.Error(new LogMessageParams()
                {
                    ModuleID = "PlaysDAL",
                    FuncCode = "DataTable SelectSSQdxListWinber()",
                    Level = AppErrorLevel.EROR,
                    ErrCode = "0x0",
                    Excep = ex,
                    logMessage = "获取双色球历史数据分析图.出错",
                    ProgramName = "Wwtilfy.BBS"
                });
                 return null;
            }
        }
          /// <summary>
        /// 查询首页的彩种开奖信息
        /// </summary>
        /// <returns></returns>
        public static IList<PlaysShowsModel> GetPlayLotteryWinNumber()
        {
            try
            {
                return PlaysDAL.GetPlayLotteryWinNumber();
            }
            catch (Exception ex)
            {
                 LoggerManage.Error(new LogMessageParams()
                {
                    ModuleID = "PlaysDAL",
                    FuncCode = "IList<PlaysShowsModel> GetPlayLotteryWinNumber()",
                    Level = AppErrorLevel.EROR,
                    ErrCode = "0x0",
                    Excep = ex,
                    logMessage = "查询首页的彩种开奖信息.出错",
                    ProgramName = "Wwtilfy.BBS"
                });
                 return null;
            }
        }
         /// <summary>
        /// 分页 获取新闻 的相关信息
        /// </summary>
        /// <param name="pageParams">分页参数</param>
        /// <param name="searchModel">新闻搜索 实体类</param>
        /// <returns>分页后的结果</returns>
        public static PagedList<PlaysShowsModel> GetPlaysShowsPageList(PageParams pageParams, PlaysShowsSearchModel searchModel)
        {
            try
            {
                return PlaysDAL.GetPlaysShowsPageList(pageParams, searchModel);
            }
            catch (Exception ex)
            {
                LoggerManage.Error(new LogMessageParams()
                {
                    ModuleID = "PlaysDAL",
                    FuncCode = " PagedList<PlaysShowsModel> GetPlaysShowsPageList(PageParams pageParams, PlaysShowsSearchModel searchModel)",
                    Level = AppErrorLevel.EROR,
                    ErrCode = "0x0",
                    Excep = ex,
                    logMessage = "彩种信息分页 的相关信息.出错",
                    ProgramName = "Wwtilfy.BBS"
                });
                return PagedList<PlaysShowsModel>.GetDefaultPageList<PlaysShowsModel>();
            }
        }

            /// <summary>
        /// 根据彩种ID获取期号相关信息
        /// </summary>
        /// <param name="LotteryId"></param>
        /// <returns></returns>
        public static IList<PlaysShowsModel> GetPlayShowList(int LotteryId)
        {
           return  PlaysDAL.GetPlayShowsList(LotteryId);
        }
		/// <summary>
		/// 根据Id获取指定的pmplays
		/// </summary>
		/// <param name="Id">/*-OriginalTableName-*/主键</param>
		/// <returns>pmplays实体</returns>
       public static PlaysShowsModel GetInfo(Int32 Id)
		{
			try
			{
                return PlaysDAL.GetInfo(Id);
			}
			catch(Exception ex)
			{
                LoggerManage.Error(new LogMessageParams()
                {
                    ModuleID = "PlaysBLL",
                    FuncCode = "PlaysShowsModel GetInfo(Int32 Id)",
                    Level = AppErrorLevel.EROR,
                    ErrCode = GET_INFO_ERROR_CODE,
                    Excep = ex,
                    logMessage = "根据Id获取指定的PlaysShowsModel.出错",
                    ProgramName = "Wwtilfy.BBS"
                });
                throw new WwtflyBusinessException("E_" + GET_INFO_ERROR_CODE, ex);
			}
		}
       /// <summary>
       /// 根据彩种类型及期号获取指定的pmplays
       /// </summary>
       /// <returns></returns>
       public static PlaysShowsModel GetInfo(int LotteryID, string PlayNo)
       {
           try
           {
               return PlaysDAL.GetInfo(LotteryID, PlayNo);
           }
           catch (Exception ex)
           {
               LoggerManage.Error(new LogMessageParams()
               {
                   ModuleID = "PlaysBLL",
                   FuncCode = "PlaysShowsModel GetInfo(int LotteryID, string PlayNo)",
                   Level = AppErrorLevel.EROR,
                   ErrCode = GET_INFO_ERROR_CODE,
                   Excep = ex,
                   logMessage = "根据彩种类型及期号获取指定的PlaysShowsModel.出错",
                   ProgramName = "Wwtilfy.BBS"
               });
               throw new WwtflyBusinessException("E_" + GET_INFO_ERROR_CODE, ex);
           }
       }	
		/// <summary>
		/// 添加新的pmplays
		/// </summary>
		/// <param name="pmplays">pmplays实体</param>
		/// <returns></returns>
       public static int Add(PlaysShowsModel pmplays)
		{
			//如果需要检查重复值，请再下面添加代码，并要抛出业务异常
			
			try
			{
                int val = PlaysDAL.Add(pmplays);
			
			   return val;
			}
			catch(Exception ex)
			{
                LoggerManage.Error(new LogMessageParams()
                {
                    ModuleID = "PlaysBLL",
                    FuncCode = "Add(PlaysShowsModel pmplays)",
                    Level = AppErrorLevel.EROR,
                    ErrCode = ADD_ERROR_CODE,
                    Excep = ex,
                    logMessage = "添加新的model(彩种信息).出错",
                    ProgramName = "Wwtilfy.BBS"
                });
                throw new WwtflyBusinessException("E_" + ADD_ERROR_CODE, ex);
			}
		}
		
		/// <summary>
		/// 修改pmplays
		/// </summary>
		/// <param name="pmplays">pmplays实体</param>
		/// <returns></returns>
       public static bool Update(PlaysShowsModel pmplays)
		{
			try
			{
                bool val = PlaysDAL.Update(pmplays);
			 
			    return val;
			}
			catch(Exception ex)
			{
                LoggerManage.Error(new LogMessageParams()
                {
                    ModuleID = "PlaysBLL",
                    FuncCode = "Update(PlaysShowsModel pmplays)",
                    Level = AppErrorLevel.EROR,
                    ErrCode = ADD_ERROR_CODE,
                    Excep = ex,
                    logMessage = "修改model(彩种信息).出错",
                    ProgramName = "Wwtilfy.BBS"
                });
                throw new WwtflyBusinessException("E_" + UPDATE_ERROR_CODE, ex);
			}
		}
		
		/// <summary>
		/// 删除pmplays
		/// </summary>
		/// <param name="Id">pm_plays主键</param>
		/// <returns></returns>
		public static bool Delete(Int32 Id)
		{
			try
			{
               bool val = PlaysDAL.Delete(Id);
			  return val;
			}
			catch(Exception ex)
			{
                LoggerManage.Error(new LogMessageParams()
                {
                    ModuleID = "PlaysBLL",
                    FuncCode = "Delete(Int32 Id)",
                    Level = AppErrorLevel.EROR,
                    ErrCode = ADD_ERROR_CODE,
                    Excep = ex,
                    logMessage = "删除model(彩种信息).出错",
                    ProgramName = "Wwtilfy.BBS"
                });
                throw new WwtflyBusinessException("E_" + DELETE_ERROR_CODE, ex);
			}
		}
    }
}
